package com.yanxml.springboot.spi.showcase;

import com.yanxml.springboot.spi.starter.ProductService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        ApplicationContext application = new SpringApplication(Application.class).run();
        // 查看是否导入相应的包
        System.out.println(application.getBean(ProductService.class));
    }
}

// 可以发现. 此处的自动装配已经成功.
// com.yanxml.springboot.spi.starter.ProductService@79c5636f

// condtionalOnClass
// 如果设置名称为JavaConfigConnection2的话, 会显示过滤加载
//Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.yanxml.springboot.spi.starter.ProductService' available
//        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:351)
//        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:342)
//        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1127)
//        at com.yanxml.springboot.spi.showcase.Application.main(Application.java:14)